package cn.ultrarisk.sprinx.mybatis.support;

import cn.ultrarisk.sprinx.mybatis.dao.MybatisDAO;

import java.util.Map;

/**
 * BaseDAO
 *
 * @author sevendlong(lin23871@163.com)
 * @date 2014/10/15
 * @since V1.0
 */
public class BaseDAO<T, P> extends MybatisDAO<T, P> {
    /**
     * 构造器
     *
     * @param entityClass       实体类型
     * @param columnPropertyMap 字段属性映射表
     */
    public BaseDAO(Class<T> entityClass, Map<String, String> columnPropertyMap) {
        super(entityClass, columnPropertyMap);
    }

    /**
     * 构建mapper文件路径
     * @return
     */
    @Override
    protected String buildMapperResourcePath() {
        return this.entityClass.getName().replace(".entity.", ".mapper.").replaceAll("\\.", "/") + "Mapper.xml";
    }
}
